package com.zfzs.post.modules.address.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @author ck
* @date 2019-09-09
*/
@Entity
@Data
@Table(name="agent_area")
public class AgentArea implements Serializable {

    @Id
    @Column(name = "area_id")
    private Long areaId;

    @Column(name = "info")
    private String info;

    @Column(name = "names")
    private String names;

    @Column(name = "phone")
    private String phone;

    // 所属代理商
    @Column(name = "agent_id")
    private Long agentId;

    // 省
    @Column(name = "province")
    private Long province;

    // 市
    @Column(name = "city")
    private Long city;

    // 区
    @Column(name = "area")
    private Long area;

    // 省 中文名
    @Column(name = "province_name")
    private String provinceName;

    // 市 中文名
    @Column(name = "city_name")
    private String cityName;

    // 区 中文名
    @Column(name = "area_name")
    private String areaName;

    // 是否默认
    @Column(name = "is_default")
    private Boolean isDefault;

    // 是否删除
    @Column(name = "is_del")
    private Boolean isDel;

    // 录入时间
    @Column(name = "create_time")
    private Timestamp createTime;

    // 最后修改时间
    @Column(name = "update_time")
    private Timestamp updateTime;

    public void copy(AgentArea source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}